<script>
import { checkCard } from '@/utils/ValidUtils.js'
export default {
  methods: {
    valid() {
      return new Promise((resolve, reject) => {
        // 身份证号强制大写字母
        let value = this.text.toUpperCase().trim()
        if (!value) {
          reject(new Error('请输入身份证号'))
        } else if (!checkCard(value)) {
          reject(new Error('身份证号不合法，请检查后重新输入'))
        } else {
          resolve(value)
        }
      })
    }

  }
}
</script>
